package com.kede.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kede.domain.ZhiUserCertifiedDomain;
import com.kede.ienum.order.CertiTypeEnum;
import com.kede.ienum.store.CertiStatueEnum;
import com.kede.mapper.ZhiUserCertifiedMapper;
import com.kede.service.ZhiUserCertifiedService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 11856
* @description 针对表【sy_zhi_user_certified(骑手认证管理)】的数据库操作Service实现
* @createDate 2023-06-01 11:42:55
*/
@Service
public class ZhiUserCertifiedServiceImpl extends ServiceImpl<ZhiUserCertifiedMapper, ZhiUserCertifiedDomain>
    implements ZhiUserCertifiedService{


    @Override
    public List<ZhiUserCertifiedDomain> findAllNormalStore() {
        LambdaQueryWrapper<ZhiUserCertifiedDomain> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ZhiUserCertifiedDomain::getType,CertiTypeEnum.STORE.getCode());
        queryWrapper.eq(ZhiUserCertifiedDomain::getStatus, CertiStatueEnum.APPROVED.getEnumIndex());
        return list(queryWrapper);
    }

    @Override
    public List<ZhiUserCertifiedDomain> findAllNormalStoreByAdcode(Integer adcode) {
        LambdaQueryWrapper<ZhiUserCertifiedDomain> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ZhiUserCertifiedDomain::getStatus, CertiStatueEnum.APPROVED.getEnumIndex());
        queryWrapper.eq(ZhiUserCertifiedDomain::getAreaCode,adcode);
        return list(queryWrapper);
    }

    @Override
    public ZhiUserCertifiedDomain getOneByUserId(Integer userId) {

        LambdaQueryWrapper<ZhiUserCertifiedDomain> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ZhiUserCertifiedDomain::getUserId,userId);
        return getOne(queryWrapper);
    }
}




